<template>
  <a-card :bordered="false" v-show="!thisIsTabPage">
  <!--分割线-->
  <a v-if="tabsShowOpetaterStatus" @click='handleTabsShowStatus' style='margin-left: 8px'>
    {{ tabsShowStatus ? '-' : '+' }}
    <a-icon :type="tabsShowStatus ? 'up' : 'down'" />
  </a>
  <!-- 折叠部分-->
  <template v-if='tabsShowStatus'>
    <!--    <a-tabs :defaultActiveKey="this.tabsCardsList.key" @change="key => onTabChange(key, 'key')" >-->
    <!--      <a-tab-pane tab="班级" key="CouClassList" >-->
    <!--        <cou-class-list ref="CouClassList" :is-show-page="this.tabsCardsList.key === 'CouClassList' " :is-show-query='false' :is-show-opt-btn="false"  ></cou-class-list>-->
    <!--      </a-tab-pane>-->
    <!--      <a-tab-pane tab="老师" key="TeaTeacherList" forceRender>-->
    <!--        <tea-teacher-list ref="TeaTeacherList" :is-show-page="this.tabsCardsList.key === 'TeaTeacherList' " :is-show-query='false' :is-show-opt-btn="false"  ></tea-teacher-list>-->
    <!--      </a-tab-pane>-->
    <!--    </a-tabs>-->
    <a-card
      style='width: 100%'
      :bordered="false"
      :tab-list='tabsCardsList.tabList'
      :active-tab-key='tabsCardsList.key'
      @tabChange="key => onTabChange(key, 'key')"
    >
      <cou-grade-list ref="CouGradeList" name="CouGradeList"  :this-is-tab-page="true" :is-show-page="this.tabsCardsList.key === 'CouGradeList' " :is-show-query='false' :is-show-opt-btn="false"  ></cou-grade-list>
      <cou-class-list ref="CouClassList" name="CouClassList" :this-is-tab-page="true" :is-show-page="this.tabsCardsList.key === 'CouClassList' " :is-show-query='false' :is-show-opt-btn="false"  ></cou-class-list>
      <tea-teacher-list ref="TeaTeacherList" name="TeaTeacherList" :this-is-tab-page="true" :is-show-page="this.tabsCardsList.key === 'TeaTeacherList' "  :is-show-query='false' :is-show-opt-btn="false"  ></tea-teacher-list>
      <stu-student-list ref="StuStudentList" name="StuStudentList" :this-is-tab-page="true" :is-show-page="this.tabsCardsList.key === 'StuStudentList' "  :is-show-query='false' :is-show-opt-btn="false" ></stu-student-list>
<!--      课表预览-->
      <cou-course-arrange-one-table ref="CouCourseArrangeOneTable" :this-is-tab-page="true" :is-show-page="this.tabsCardsList.key === 'CouCourseArrangeOneTable' "  :is-show-query='false' :is-show-opt-btn="false"></cou-course-arrange-one-table>
    </a-card>
  </template>
  </a-card>
</template>

<script>
import '@/assets/less/TableExpand.less'
import { mixinDevice } from '@/utils/mixin'
import { JeecgListMixin } from '@/mixins/JeecgListMixin'
import CouClassList from '@views/smart_school/classes/CouClassList'
import TeaTeacherList from '@views/smart_school/teacher/TeaTeacherList'
import CouGradeList from '@views/smart_school/grade/CouGradeList'
import StuStudentList from '@views/smart_school/student/StuStudentList'
import CouGradeModal from '@views/smart_school/grade/modules/CouGradeModal'
import PreviewCourseArrangeDetails from '@views/smart_school/coursearrangePreview/PreviewCourseArrangeDetails'
import CouCourseArrangeOneTable from '@views/smart_school/coursearrangePreview/CouCourseArrangeOneTable'
export default {
  name: 'refListCards',
  mixins:[JeecgListMixin, mixinDevice],
  components: {
    CouGradeList,
    CouClassList,
    TeaTeacherList,
    StuStudentList,
    //课表预览:全校课表一张表
    CouCourseArrangeOneTable,
  },
  props: {
    //变量优先级顺序：props的优先级>data中的优先级>methods中的优先级
    //是否显示全部页面
    isShowAllTabsPage: {
      type: Boolean,
      default: true
    },
    //本页面是否是被引用的tab页面，tab页面隐藏部分组件
    //此处 主要为了避免嵌套引用
    thisIsTabPage: {
      type: Boolean,
      default: false
    },
    tabsCardsList: {
      type: Object,
      required: true,
      default:  function() {
        return {key: null,tab: null};
      }
      //被引用的table列表清单
      // { key: 'CouClassList',  tabList: [  {   key: 'CouClassList',  tab: '班级'  },  { key: 'TeaTeacherList',  tab: '老师'  },  ], }
    },
    //被引用tabs所需的数据
    tabsQueryParamDatas:{
      type: Object,
      required: true,
      default:  function() {
        return {gradeId: null,classId: null};
      }
      //{年级，班级，学生}
      //{gradeId:'',classId:'':studentsId:''}
    }

  },
  watch: {
    // tabsCardsList: function(val) {
    //   console.log("RefListCards.tabsCardsList:"+val)
    // },
    tabsCardsList: function(val) {
      console.log("RefListCards.tabsCardsList:"+val)
      console.log("RefListCards.tabsCardsList:key="+val.key)
      this.onSelectChangeTab(val)
    },
    tabsQueryParamDatas: function(val) {
      console.log("RefListCards.tabsQueryParamDatas:"+val)
      this.onSelectChangeTab(val)
    },
  },
  data() {
    return {
      description: '通用引用tab页面',
      // vDict: 'cou_class,class_name,id',

      //
      disableMixinCreated: true,
      //是否显示惭怍按钮
      tabsShowOpetaterStatus: true,
      //是否显示tab列表
      tabsShowStatus: true,

    }
  },
  created() {
  },
  mounted() {
  },
  computed: {
  },
  methods: {
    //折叠或展开
    handleTabsShowStatus(){
      this.tabsShowStatus = !this.tabsShowStatus;
    },
    //切换tab
    onTabChange(value, type) {
      this.tabsCardsList.key = value
      this.checkValueKeyIsShow(this.tabsCardsList.key)
      this.onSelectChangeTab(this.tabsQueryParamDatas)
    },
    //控制是否显示:控制显示哪一个tab
    checkValueKeyIsShow(key) {
    },
    //切换tab
    onSelectChangeTab(refsTabQueryParam) {
      // this.selectedRowKeys = selectedRowKeys
      // this.selectionRows = selectionRows
      console.log("RefListCards.onSelectChangeTab():refsTabQueryParam="+refsTabQueryParam)
      console.log("RefListCards.onSelectChangeTab():,this.tabsCardsList.key="+this.tabsCardsList.key)

        if (this.tabsCardsList.key === "CouClassList"){
          //封装查询条件
          // var refsTabQueryParam={gradeId:this.selectedRowKeys[0]}
          //调用查询方法
          this.$refs.CouClassList.getOrderMain(refsTabQueryParam)
        }else if (this.tabsCardsList.key === "StuStudentList"){
          //封装查询条件
          // var refsTabQueryParam={gradeId:this.selectedRowKeys[0]}
          //调用查询方法
          this.$refs.StuStudentList.getOrderMain(refsTabQueryParam)
        }else if (this.tabsCardsList.key === "TeaTeacherList"){
          //封装查询条件
          // var refsTabQueryParam={gradeId:this.selectedRowKeys[0]}
          //调用查询方法
          this.$refs.TeaTeacherList.getOrderMain(refsTabQueryParam)
        }else if (this.tabsCardsList.key === "CouCourseArrangeOneTable"){
          //封装查询条件
          // var refsTabQueryParam={gradeId:this.selectedRowKeys[0]}
          //调用查询方法
          this.$refs.CouCourseArrangeOneTable.getOrderMain(refsTabQueryParam)
        }

    },
  }
}
</script>

<style scoped>

</style>